<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ViewLivreTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputText value="#{bundle.ViewItemLabel_ref}" />
                    <h:outputText id="ref" value="#{livreController.selected.item.ref}" title="#{bundle.ViewItemTitle_ref}" />
                    <h:outputText value="#{bundle.ViewItemLabel_dateAjout}" />
                    <h:outputText value="#{livreController.selected.item.dateAjout}" title="#{bundle.ViewItemTitle_dateAjout}">
                        <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
                    </h:outputText>
                    <h:outputText value="#{bundle.ViewItemLabel_etat}" />
                    <h:outputText value="#{livreController.selected.item.etat}" title="#{bundle.ViewItemTitle_etat}" />
                    <h:outputText value="#{bundle.ViewItemLabel_dateParution}" />
                    <h:outputText value="#{livreController.selected.item.dateParution}" title="#{bundle.ViewItemTitle_dateParution}" >
                        <f:convertDateTime pattern="dd/MM/yyyy" />
                    </h:outputText>
                    <h:outputText value="#{bundle.ViewItemLabel_type}" />
                    <h:outputText value="#{livreController.selected.item.type.libelle}" title="#{bundle.ViewItemTitle_type}" />
                    <h:outputText value="#{bundle.ViewLivreLabel_titre}" />
                    <h:outputText value="#{livreController.selected.titre}" title="#{bundle.ViewLivreTitle_titre}" />
                    <h:outputText value="#{bundle.ViewLivreLabel_collection}" />
                    <h:outputText value="#{livreController.selected.collection}" title="#{bundle.ViewLivreTitle_collection}" />
                    <h:outputText value="#{bundle.ViewLivreLabel_auteur}" />
                    <h:outputText value="#{livreController.selected.auteur}" title="#{bundle.ViewLivreTitle_auteur}" />
                    <h:outputText value="#{bundle.ViewLivreLabel_genre}" />
                    <h:outputText value="#{livreController.selected.genre.name}" title="#{bundle.ViewLivreTitle_genre}" />
                </h:panelGrid>
                <hr />
                <h2>Exemplaires :</h2>
                <h:panelGrid columns="2">
                    <c:forEach var="exemplaire" items="#{livreController.selected.item.exemplaireList}">
                        <h:outputText value="#{bundle.ViewExemplaireLabel_numeroArticle}"/>
                        <h:outputText value="#{exemplaire.numeroArticle}" title="#{bundle.ViewExemplaireTitle_numeroArticle}"/>
                        <h:outputText value="#{bundle.ViewExemplaireLabel_etat}"/>
                        <h:outputText value="#{exemplaire.etat}" title="#{bundle.ViewExemplaireTitle_etat}"/>
                    </c:forEach>
                </h:panelGrid>
                <br />
                <h:commandLink action="#{livreController.destroyAndView}" value="#{bundle.ViewLivreDestroyLink}"/>
                <br />
                <h:commandLink action="Edit" value="#{bundle.ViewLivreEditLink}"/>
                <h:commandLink action="#{livreController.prepareCreate}" value="#{bundle.ViewLivreCreateLink}" />
                <h:commandLink action="#{livreController.prepareList}" value="#{bundle.ViewLivreShowAllLink}"/>
                <br />
                <h:commandLink value="#{bundle.ViewLivreIndexLink}" action="/index" immediate="true" />

            </h:form>
        </ui:define>
    </ui:composition>

</html>
